dcdpr / dcdpr/jp

Add templated embedded tool schemas with dynamic property generation

Open
#197 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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:

  1. Receive the current JSON schema via stdin
  2. Have access to workspace context and configuration
  3. Return the final processed schema via stdout
  4. Be executed when jp query starts 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 preprocessor field to McpTool struct in crates/jp_mcp/src/tool.rs
  • Update tool loading logic in crates/jp_storage/src/lib.rs to 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

  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.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.