Skip to content

Add specific type hints to MCP tool functions#295

Open
ykd007 wants to merge 1 commit into
msoedov:mainfrom
ykd007:add-type-hints-mcp-198
Open

Add specific type hints to MCP tool functions#295
ykd007 wants to merge 1 commit into
msoedov:mainfrom
ykd007:add-type-hints-mcp-198

Conversation

@ykd007
Copy link
Copy Markdown
Contributor

@ykd007 ykd007 commented May 15, 2026

Closes #198

The MCP functions were using bare dict and list as return type annotations. This replaces them with dict[str, Any] and list[dict[str, Any]] to give IDEs and static analysis tools (mypy/pyright) meaningful information about the shapes involved.

Changes:

  • verify_llm, start_scan, stop_scan: return type dictdict[str, Any]
  • get_data_config, get_spec_templates: return type listlist[dict[str, Any]]
  • Local payload variable in start_scan annotated as dict[str, Any]
  • client.run(): tightened from -> None to -> tuple[Any, Any, Any] | None to reflect the actual return value (prompts, resources, tools) or None on error
  • Added from typing import Any to both files

Use dict[str, Any] and list[dict[str, Any]] instead of plain dict/list
for the MCP tool return types, and add a proper return type annotation
to client.run(). Also imports typing.Any where needed so IDEs and mypy
can reason about the shapes without losing flexibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add type hints to function parameters in mcp

1 participant