Skip to main content
Glama
AbdessamadTzn

FastAPI Architect MCP

get_completions

Get completion suggestions at a given cursor position in a FastAPI file to improve development speed.

Instructions

Return completion suggestions at the given cursor position.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYes
lineYes
columnYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'get_completions' tool. It uses Jedi to compute completion suggestions at a given cursor position (file, line, column) and returns a list of dicts with name, type, and description.
    def get_completions(file: str, line: int, column: int) -> list[dict]:
        """Return completion suggestions at the given cursor position."""
        script = jedi.Script(path=file, project=_project(file))
        return [
            {"name": c.name, "type": c.type, "description": c.docstring(raw=True)[:120]}
            for c in script.complete(line=line, column=column)
        ]
  • The tool registration via the @mcp.tool() decorator on line 81, which registers 'get_completions' with the FastMCP server.
    @mcp.tool()
    def get_completions(file: str, line: int, column: int) -> list[dict]:
  • The _project helper function used by get_completions to locate the project root by walking up from the file looking for pyproject.toml, requirements.txt, or setup.py.
    def _project(file: str) -> jedi.Project:
        """Walk up from file to find the project root."""
        path = Path(file).resolve()
        for parent in [path.parent, *path.parents]:
            if any((parent / f).exists() for f in ("pyproject.toml", "requirements.txt", "setup.py")):
                return jedi.Project(path=str(parent))
        return jedi.Project(path=str(path.parent))
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description is minimal. It does not disclose whether the operation is read-only, what happens if the file does not exist, any side effects, or error behaviors.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that is easy to parse and front-loaded. However, it is borderline too short and could include more detail without sacrificing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations, the description is too brief to be complete. It does not explain the output schema (though it exists), error handling, or any prerequisites for using the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero description coverage for its parameters. The description only loosely implies that 'line' and 'column' define the cursor position but does not explain file path format or indexing conventions (e.g., 0-based vs 1-based).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns completion suggestions at a given cursor position, using a specific verb and resource. It distinguishes itself from sibling tools like find_references or go_to_definition, which serve different navigation purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidelines are provided about when to use this tool versus alternatives. The agent must infer usage from the name and description, with no explicit context or exclusion criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AbdessamadTzn/fastapi-architect-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server