Skip to content

Conversation

@kaipiyann
Copy link

@kaipiyann kaipiyann commented Oct 31, 2025

Add _meta field to schema

Motivation and Context

Field meta from the spec is missing
https://modelcontextprotocol.io/specification/2025-06-18/basic#meta

How Has This Been Tested?

Tested with MCP Inspector

Breaking Changes

No

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

public function __construct(
public ?string $name = null,
public ?string $description = null,
public ?array $_meta = null
Copy link
Contributor

Choose a reason for hiding this comment

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

You could name the PHP variables $meta instead to stay consistent with how meta is handled in the Request class, and then when serializing to and from array, use the _meta key where neccesary

Copy link
Author

Choose a reason for hiding this comment

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

Yes I could have but :

  • it seems to me it was inconsistent before cause ListRootsResult and InitializeResult are using _meta
  • I thought it was easier to be consistent with the naming of the shema
  • And now there is a lot more _meta than meta ;-)
    I hope you don't mind

Copy link
Member

Choose a reason for hiding this comment

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

I agree with @CodeWithKyrian here, so let's fix that with #134

mimeType: $data['mimeType'] ?? null,
annotations: isset($data['annotations']) ? Annotations::fromArray($data['annotations']) : null
annotations: isset($data['annotations']) ? Annotations::fromArray($data['annotations']) : null,
_meta: isset($data['_meta']) ? (int) $data['_meta'] : null
Copy link
Contributor

Choose a reason for hiding this comment

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

Same int cast issue here

Copy link
Author

Choose a reason for hiding this comment

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

Corrected also

@kaipiyann
Copy link
Author

kaipiyann commented Nov 1, 2025

And this time I did run all the tests also so it should pass the check.

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.

3 participants