Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add optional lastModified timestamp to Annotated #140

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

salman1993
Copy link

@salman1993 salman1993 commented Jan 13, 2025

Adds an optional timestamp field to Annotated interface.

Motivation and Context

It's useful to know when a Resource is created or updated for context truncation.

How Has This Been Tested?

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Copy link
Member

@jspahrsummers jspahrsummers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion!

Can you share a bit more about how you might use this to truncate context, just so I have a greater understanding of the use case? I think it probably makes sense, but would love more detail.

Also left a couple of minor comments for discussion. 🙏

schema/schema.ts Outdated
@@ -832,6 +832,13 @@ export interface Annotated {
* @maximum 1
*/
priority?: number;

/**
* The timestamp indicating when this annotation was created or last updated.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be about the annotation (only) or about the thing that the annotation is attached to? I lean toward the latter—maybe we could update the phrasing to reflect this?

schema/schema.ts Outdated
*
* Should be an ISO 8601 formatted string (e.g., "2025-01-12T15:00:58Z").
*/
timestamp?: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to have other timestamps in future, so perhaps a more specific name like:

Suggested change
timestamp?: string;
lastModified?: string;

* upstream/main:
  docs: update README links
  chore: add markdown format check workflow and format all docs
  chore: add prettier and format command for markdown files
  Move schema files to versioned directory
  Fix broken links. 2024-11-05 schema.ts/schema.json points to main/schema/2024-11-05/schema.ts in anticipation of PR modelcontextprotocol#145 being merged.
  update generate json after merge
  update protocol revision to draft on sampling page
  updated schema protocol version to reflect draft.
  change to relative link in spec
  point documentation changes to "draft"
  Revert schema/schema.ts to upstream/main, add drafts folder. Update validate and build scripts to build drafts too.
  fix: update draft page reference and add alias for better navigation
  fix: incorrect link for "Specification (Draft)" on nav bar
  Update schema/schema.ts
  remove spurious semicolon
  validation, simplify wording.
  Add optional "size" attribute to Resource, include in Documentation
  Update docs/specification/client/sampling.md
  Updated Specification and Docs to support Audio Modality.
@salman1993 salman1993 changed the title feat: add optional timestamp to Annotated feat: add optional lastModified timestamp to Annotated Jan 28, 2025
@salman1993
Copy link
Author

@jspahrsummers sorry for the delay on this one. I updated the name and added some examples to the docstring.

Generally, the idea here is that since resources are application controlled, it's useful to pass in the lastModified timestamp of the attached data especially for truncation when we exceed context limits (eg. evict files that have no recent activity)

Copy link
Contributor

@jerome3o-anthropic jerome3o-anthropic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me, thanks for adding this

dsp-ant
dsp-ant previously approved these changes Feb 13, 2025
Comment on lines 835 to 842

/**
* The timestamp when the resource was last modified.
* Examples: last activity timestamp in an open file, timestamp when resource is attached, etc.
*
* Should be an ISO 8601 formatted string (e.g., "2025-01-12T15:00:58Z").
*/
lastModified?: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants