Files
Orchestrator/bahn/teamlandkarte-mcp/.github/prompts/add-mcp-tool.prompt.md
T
ankn a5f8fb49ab Migrate all repos into monorepo context folders
Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
      Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
      Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)

Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
2026-06-30 20:39:52 +02:00

1.8 KiB

description
description
Add a new MCP tool to the Teamlandkarte server following established patterns.

$ARGUMENTS

Adding a New MCP Tool

When adding a new MCP tool to src/teamlandkarte_mcp/mcp_server.py, follow these patterns:

Naming Convention

  • Use verb_noun pattern (e.g., find_matching_capacities, get_task_details, list_open_tasks)
  • Prefix with mcp_ in the function name for the decorator

Required Structure

  1. Define the tool function with @mcp.tool() decorator
  2. Add clear parameter schemas with descriptions and types
  3. Return Markdown-formatted output (tables for structured data)
  4. Include proper error messages for invalid inputs
  5. Produce deterministic outputs (same input → same output, modulo cache)

Checklist

  • Tool function defined in mcp_server.py with @mcp.tool() decorator
  • Parameters have type hints and descriptions
  • Output uses Markdown tables for structured data
  • Error handling for invalid inputs (return helpful error messages)
  • No secrets or credentials in output
  • Read-only database access (never write to Trino)
  • Add corresponding test in tests/
  • Run uv run ruff check src/ tests/ and uv run mypy src/
  • Update docs/assistant_system_prompt.md with the new tool documentation

Example Pattern

@mcp.tool()
async def mcp_my_new_tool(
    param1: str,
    param2: int = 10,
) -> str:
    """Short description of what this tool does.

    Args:
        param1: Description of param1.
        param2: Description of param2 (default: 10).
    """
    # Implementation
    result = await some_operation(param1, param2)
    # Format as Markdown table
    return format_as_markdown_table(result)

Security

  • Never expose credentials in tool output
  • Never write to the database
  • Validate all inputs before processing