Skip to content

Add RMCP interop functions to FunctionDeclaration - #66

Open
rileyg98 wants to merge 2 commits into
flachesis:mainfrom
rileyg98:main
Open

Add RMCP interop functions to FunctionDeclaration#66
rileyg98 wants to merge 2 commits into
flachesis:mainfrom
rileyg98:main

Conversation

@rileyg98

Copy link
Copy Markdown

Fixes #65 by adding functions to allow setting of parsed parameter and response schema objects.

@flachesis
flachesis self-requested a review January 27, 2026 02:44
@flachesis

Copy link
Copy Markdown
Owner

It looks like the format check failed. Could you run cargo fmt and push the changes again?

@flachesis
flachesis requested a review from Copilot February 11, 2026 12:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds RMCP interop APIs to FunctionDeclaration so callers can set pre-parsed parameter/response JSON schema objects directly.

Changes:

  • Add with_parsed_parameters(Value) builder for setting parameters from an already-parsed JSON value
  • Add with_parsed_response(Value) builder for setting response from an already-parsed JSON value

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tools/model.rs
Comment on lines +250 to +253
pub fn with_parsed_parameters(mut self, parameters: Value) -> Self {
self.parameters = Some(parameters.clone());
self
}

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

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

Both methods take ownership of Value, but still .clone() it before storing. This adds unnecessary allocations/copies; assign the moved value directly (e.g., Some(parameters) / Some(response)).

Copilot uses AI. Check for mistakes.
Comment thread src/tools/model.rs
Comment on lines +264 to +267
pub fn with_parsed_response(mut self, response: Value) -> Self {
self.response = Some(response.clone());
self
}

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

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

Both methods take ownership of Value, but still .clone() it before storing. This adds unnecessary allocations/copies; assign the moved value directly (e.g., Some(parameters) / Some(response)).

Copilot uses AI. Check for mistakes.
Comment thread src/tools/model.rs
self.parameters = Some(generate_parameters_schema::<Parameters>());
self
}
/// Sets the parameters for the function using a raw json_serde::Value. Allows interop with RMCP Tool structs.

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

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

The docs reference json_serde::Value, but the code uses Value (commonly serde_json::Value). Consider updating the wording to match the actual type/source, and fix the missing space after /// on line 263 for consistent rustdoc formatting.

Copilot uses AI. Check for mistakes.
Comment thread src/tools/model.rs
self.response = Some(generate_parameters_schema::<Response>());
self
}
///Sets the response schema for the function using a raw json_serde::Value. Allows interop with RMCP Tool structs.

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

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

The docs reference json_serde::Value, but the code uses Value (commonly serde_json::Value). Consider updating the wording to match the actual type/source, and fix the missing space after /// on line 263 for consistent rustdoc formatting.

Copilot uses AI. Check for mistakes.
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.

FunctionDefinition only accepts raw struct types for setting parameter and response schemas

3 participants