Skip to main content
Glama

chunk_details

Retrieve full content of a specific code chunk by its ID, enabling focused examination after identifying relevant code sections through intelligent search tools.

Instructions

Get full content of a specific chunk.

Returns chunk content as string.

Common patterns:
1. Final step after find_matching_chunks_in_file finds relevant chunks
2. Examining implementations after finding definitions/uses

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chunk_idYes

Implementation Reference

  • The handler function for the 'chunk_details' tool. It takes a chunk_id, searches through all loaded projects and files for the matching chunk, and returns its content using MCPToolOutput. Decorators @mcp.tool() registers it and @log_inputs_outputs() logs inputs/outputs.
    @mcp.tool()
    @log_inputs_outputs()
    def chunk_details(
        chunk_id: str,
    ) -> ToolResponse:
        """Get full content of a specific chunk.
    
        Returns chunk content as string.
    
        Common patterns:
        1. Final step after find_matching_chunks_in_file finds relevant chunks
        2. Examining implementations after finding definitions/uses
        """
        # Yeah this is an awful brute force "search" - if it is even deserving of the
        # name "search"! Ah well.
        the_chunk: Chunk | None = None
        for project in PROJECTS.values():
            for file in project.chunk_project.files:
                for chunk in file.chunks:
                    if chunk.id_(file.abs_path) == chunk_id:
                        the_chunk = chunk
                        break
    
        if the_chunk is None:
            return MCPToolOutput(
                text="No matching chunks. Please use other tools to find available chunks.",
            ).render()
        return MCPToolOutput(text=inspect.cleandoc(the_chunk.content)).render()
  • The @mcp.tool() decorator registers the chunk_details function as an MCP tool.
    @mcp.tool()

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related 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/jurasofish/mcpunk'

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