Skip to main content
Glama
self-tech-labs

Entscheidsuche MCP Server

Search Swiss Case Law

search_case_law

Search and retrieve Swiss court decisions using a structured query. Access legal documents from Swiss jurisdictions for analysis or reference, with options for pagination and result size.

Instructions

Search for Swiss court decisions using Entscheidsuche database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromNoStarting position for pagination
queryYesSearch query for legal cases
sizeNoNumber of results to return (max 50)

Implementation Reference

  • The handler function that executes the 'search_case_law' tool logic. It limits the result size, calls the client's searchCases method, formats the results into a structured output, and handles errors.
    async ({ query, size = 10, from = 0 }) => {
      try {
        // Limit size to prevent abuse
        const limitedSize = Math.min(size, 50);
        
        const results = await client.searchCases(query, limitedSize, from);
        
        const formattedResults = results.hits.hits.map(hit => {
          const source = hit._source;
          return {
            signature: hit._id,
            court: source.hierarchy[1] || source.canton,
            language: source.attachment.language,
            date: source.date,
            case_number: source.reference[0] || '',
            title_de: source.title.de,
            title_fr: source.title.fr,
            title_it: source.title.it,
            abstract_de: source.abstract?.de || '',
            abstract_fr: source.abstract?.fr || '',
            abstract_it: source.abstract?.it || '',
            has_html: !!source.attachment.content_url,
            has_pdf: false, // PDF availability not indicated in new structure
            document_url: source.attachment.content_url,
            scrapedate: source.scrapedate
          };
        });
    
        const summary = `Found ${results.hits.total.value} total cases matching "${query}". Showing ${formattedResults.length} results starting from position ${from}.`;
        
        return {
          content: [
            {
              type: "text",
              text: `${summary}\n\n${JSON.stringify(formattedResults, null, 2)}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error searching case law: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • Input schema for the 'search_case_law' tool using Zod, defining parameters query, size, and from.
    inputSchema: {
      query: z.string().describe("Search query for legal cases"),
      size: z.number().optional().default(10).describe("Number of results to return (max 50)"),
      from: z.number().optional().default(0).describe("Starting position for pagination")
    }
  • src/index.ts:210-270 (registration)
    Registration of the 'search_case_law' tool with the MCP server, specifying the tool name, metadata, input schema, and handler function.
      "search_case_law",
      {
        title: "Search Swiss Case Law",
        description: "Search for Swiss court decisions using Entscheidsuche database",
        inputSchema: {
          query: z.string().describe("Search query for legal cases"),
          size: z.number().optional().default(10).describe("Number of results to return (max 50)"),
          from: z.number().optional().default(0).describe("Starting position for pagination")
        }
      },
      async ({ query, size = 10, from = 0 }) => {
        try {
          // Limit size to prevent abuse
          const limitedSize = Math.min(size, 50);
          
          const results = await client.searchCases(query, limitedSize, from);
          
          const formattedResults = results.hits.hits.map(hit => {
            const source = hit._source;
            return {
              signature: hit._id,
              court: source.hierarchy[1] || source.canton,
              language: source.attachment.language,
              date: source.date,
              case_number: source.reference[0] || '',
              title_de: source.title.de,
              title_fr: source.title.fr,
              title_it: source.title.it,
              abstract_de: source.abstract?.de || '',
              abstract_fr: source.abstract?.fr || '',
              abstract_it: source.abstract?.it || '',
              has_html: !!source.attachment.content_url,
              has_pdf: false, // PDF availability not indicated in new structure
              document_url: source.attachment.content_url,
              scrapedate: source.scrapedate
            };
          });
    
          const summary = `Found ${results.hits.total.value} total cases matching "${query}". Showing ${formattedResults.length} results starting from position ${from}.`;
          
          return {
            content: [
              {
                type: "text",
                text: `${summary}\n\n${JSON.stringify(formattedResults, null, 2)}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error searching case law: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Supporting method in EntscheidungsucheClient that performs the actual API search to the Entscheidsuche endpoint, used by the tool handler.
    async searchCases(query: string, size: number = 10, from: number = 0): Promise<SearchResult> {
      const searchBody = {
        query: {
          simple_query_string: {
            query: query,
            default_operator: "and"
          }
        },
        size,
        from,
        sort: [{ date: { order: "desc" } }]
      };
    
      const response = await fetch(this.searchEndpoint, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify(searchBody)
      });
    
      if (!response.ok) {
        throw new Error(`Search failed: ${response.status} ${response.statusText}`);
      }
    
      return await response.json();
    }
Behavior2/5

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

With no annotations, the description carries full burden but only states the basic function. It lacks details on behavioral traits such as rate limits, authentication needs, error handling, or what the search returns (e.g., result format, metadata). This is inadequate for a search tool with no output schema.

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 a single, efficient sentence that directly states the tool's purpose without redundancy. It's front-loaded and wastes no words, making it easy to parse quickly.

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 complexity of a search tool with no annotations or output schema, the description is insufficient. It doesn't explain what the search returns, how results are structured, or any limitations, leaving gaps for the agent to understand the tool's behavior fully.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents parameters like 'query' for search terms and 'from/size' for pagination. The description adds no additional meaning beyond implying a legal context, meeting the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the action ('Search') and target resource ('Swiss court decisions') with the specific database ('Entscheidsuche'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_document' or 'list_courts', which might also retrieve legal information.

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 guidance is provided on when to use this tool versus alternatives. The description doesn't mention scenarios for searching case law compared to getting specific documents or listing courts, leaving the agent to infer usage from tool names alone.

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

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/self-tech-labs/entscheidsuche-MCP-server'

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