Skip to main content
Glama
gclluch
by gclluch

get_type_definition

Extract the complete definition of a Python type, including members and source code, from a specified file. Supports classes, TypeAlias, Enum, Protocol, TypedDict, and NamedTuple.

Instructions

Extract a class, TypeAlias, Enum, Protocol, TypedDict or NamedTuple definition with its members and source.

Args: path: Path to a .py file. name: Type name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

With no annotations provided, the description discloses the primary behavior—extracting definitions with members and source—but does not elaborate on edge cases, error handling, or whether the name must be fully qualified. It adds minimal behavioral context beyond the action itself.

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

Conciseness5/5

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

The description is two sentences plus an Args block, with no wasted words. The purpose is front-loaded, and parameter explanations are concise and directly tied to the schema.

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

Completeness4/5

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

The description covers the core functionality and both parameters, and the presence of an output schema reduces the need to detail return structure. However, it does not mention behavior for missing definitions or name resolution across files, leaving minor gaps for an extraction tool with two parameters.

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

Parameters5/5

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

The schema provides only param types with no descriptions, while the description adds meaningful semantic information: path is 'Path to a .py file' and name is 'Type name'. This fully compensates for the 0% schema coverage, giving clear meaning to both parameters.

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 uses the specific verb 'Extract' and clearly enumerates the supported type kinds (class, TypeAlias, Enum, Protocol, TypedDict, NamedTuple), distinguishing this from sibling tools like get_function_body or list_declarations. It also states that members and source are included, making the scope unambiguous.

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

Usage Guidelines4/5

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

The description implies usage when needing a type definition from a Python file, and the type list differentiates it from function/method tools. However, it does not explicitly mention alternatives or exclusions, so the context is clear but not fully prescriptive.

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/gclluch/py-ast-mcp'

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