Dynamic Tool Description based on Route Variable in path

Open
#758 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
api, backend

Research direction

Start by reviewing the C# MCP SDK's route handling and tool-list response generation; the issue does not name specific files or tests. Compare the requested /{routeVariable1}/mcp/tools/list examples and determine where route context could affect a tool description. Done means establishing whether this pattern is supported and documenting or demonstrating the implementation path.

Written by the indexing model from the issue text.

Description

enhancement needs confirmation

Is your feature request related to a problem? Please describe.

We're trying to create an MCP Server Tool on an asp.net server using this SDK.
As a part of this- we'd like a way to support dynamic descriptions of an mcp tool based on a route variable in the path.
Example-
Request path - /{routeVariable1}/mcp
For the tool list call- we'd like to have a tool description generated based on the value of the routeVariable1. A method call like GetToolDescription(IHttpContext context) => "This is the description for {context.GetRouteVariable["routeVariable1"]} tool.

Sample request/responses
Example 1
/routevariable1/mcp/tools/list
--> returns "This is the description for routevariable1 tool.
Example 2
/routevariable2/mcp/tools/list
--> returns "This is the description for routevariable2 tool.
Is the above pattern supported by the C# MCP SDK?
If yes, could you point me to a sample of how we could implement this?

Dominant language
C#
Stars
4.5k
Forks
814
Avg merge
9d 19h
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

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.