Add templated embedded tool schemas with dynamic property generation
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16
- Forks
- 3
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 121
Description
Embedded MCP tools currently have static schemas defined in TOML files, but many tools could benefit from dynamically generated schemas based on external data sources. For example, a GitHub label management tool should have an enum of valid label names fetched from the GitHub API, ensuring the assistant only suggests valid options.
Context
When working with tools that interact with external systems, the available options or valid values often change dynamically. Currently, MCP tool schemas in .jp/mcp/tools/*.toml files have static properties definitions that cannot adapt to external data sources.
A common example is GitHub integration tools - a tool for adding labels to issues should present an enum of all available labels in the repository, but these labels are managed dynamically through GitHub's interface and can change over time.
Alternatives
Manual schema updates could work but would require constant maintenance as external data changes. Static schemas with string validation in the tool implementation could work but provide poor UX as the assistant wouldn't know valid options upfront.
Proposed Implementation
Add a preprocessor field to the MCP tool TOML configuration that points to an executable file. This executable would:
- Receive the current JSON schema via stdin
- Have access to workspace context and configuration
- Return the final processed schema via stdout
- Be executed when
jp querystarts and the tool is available
For caching, start with rebuilding schemas on each jp query command startup, with future TTL/caching optimizations as a follow-up enhancement.
Example TOML configuration:
[tool]
description = "Add labels to GitHub issues"
command = ["github_label_tool"]
preprocessor = "scripts/github_labels_preprocessor.sh"
[[tool.properties]]
name = "labels"
type = "array"
# This enum will be populated by the preprocessor
items = { type = "string" }
The preprocessor script would fetch available labels via GitHub API and inject them into the schema enum.
Tasks
- Add
preprocessorfield toMcpToolstruct incrates/jp_mcp/src/tool.rs - Update tool loading logic in
crates/jp_storage/src/lib.rsto execute preprocessor if specified - Add schema preprocessing to embedded server tool enumeration in
crates/jp_mcp/src/server/embedded.rs - Add error handling for preprocessor execution failures
- Add documentation and examples for preprocessor usage
Resources
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the McpTool definition in crates/jp_mcp/src/tool.rs and the tool-loading path around crates/jp_storage/src/lib.rs:207-227, then inspect embedded tool enumeration in crates/jp_mcp/src/server/embedded.rs:78-130. The work is done when configured preprocessors can transform schemas during jp query startup, failures are handled, and documentation and examples cover the configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, rust
- Domain
- api, cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100