Describing function parameters and result with dynamically generated tools

Open
#2,029 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
57/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp

Research direction

Start with McpServerTool.Create and its McpServerToolCreateOptions, SchemaCreateOptions, and ParameterDescriptionProvider APIs; compare their behavior with KernelFunctionFactory.CreateFromMethod, which the issue cites. Work out how parameter and return value descriptions are supplied for dynamically generated tools, then provide a simple sample showing the supported approach.

Written by the indexing model from the issue text.

Description

Let's say I create a tool with McpServerTool.Create(MethodInfo, object, McpServerToolCreateOptions) function, what is the best way to describe parameters and result?

Are the only ways to use McpServerToolCreateOptions.SchemaCreateOptions or/and ParameterDescriptionProvider ( But then how does one describe return value - OutputSchema?)?

Or is there a way to pass descriptions through a property?
I mean like Microsoft.SemanticKernel.KernelFunctionFactory.CreateFromMethod where there is a parameters parameter when one can describe parameters and a returnParameter parameter for result.

A simple sample would be appreciated.

Dominant language
C#
Stars
4.6k
Forks
849
Avg merge
1d 16h
Merged PRs (30d)
24

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/csharp-sdk

All issues in modelcontextprotocol/csharp-sdk

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.