Skip to main content
Glama

设置默认上下文

gitea_context_set

Set default context for Gitea operations by configuring owner, repository, organization, or project parameters to streamline subsequent interactions.

Instructions

Set default context for subsequent operations. All parameters are optional.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerNoDefault owner (username or organization)
repoNoDefault repository name
orgNoDefault organization name
projectNoDefault project ID

Implementation Reference

  • Handler function for the 'gitea_context_set' tool. Retrieves the old context, sets the new context using ctx.contextManager.setContext(args), retrieves the new context, and returns a JSON response with old and new contexts.
    async (args) => {
      const oldContext = ctx.contextManager.getContext();
      ctx.contextManager.setContext(args);
      const newContext = ctx.contextManager.getContext();
    
      return {
        content: [
          {
            type: 'text' as const,
            text: JSON.stringify(
              {
                success: true,
                message: 'Context updated successfully',
                oldContext,
                newContext,
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • Zod input schema defining optional parameters: owner, repo, org, project for setting the default context.
    inputSchema: z.object({
      owner: z.string().optional().describe('Default owner (username or organization)'),
      repo: z.string().optional().describe('Default repository name'),
      org: z.string().optional().describe('Default organization name'),
      project: z.number().optional().describe('Default project ID'),
    }),
  • src/index.ts:503-538 (registration)
    Registration of the 'gitea_context_set' tool using mcpServer.registerTool, including title, description, input schema, and inline handler function.
    mcpServer.registerTool(
      'gitea_context_set',
      {
        title: '设置默认上下文',
        description: 'Set default context for subsequent operations. All parameters are optional.',
        inputSchema: z.object({
          owner: z.string().optional().describe('Default owner (username or organization)'),
          repo: z.string().optional().describe('Default repository name'),
          org: z.string().optional().describe('Default organization name'),
          project: z.number().optional().describe('Default project ID'),
        }),
      },
      async (args) => {
        const oldContext = ctx.contextManager.getContext();
        ctx.contextManager.setContext(args);
        const newContext = ctx.contextManager.getContext();
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify(
                {
                  success: true,
                  message: 'Context updated successfully',
                  oldContext,
                  newContext,
                },
                null,
                2
              ),
            },
          ],
        };
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states that parameters are optional but doesn't disclose what happens if none are provided (e.g., clears context, uses defaults), whether this persists across sessions, or any side effects like authentication requirements or rate limits.

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 extremely concise—two short sentences with zero wasted words. It's front-loaded with the core purpose and efficiently notes parameter optionality, 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 context-setting tool with no annotations and no output schema, the description is inadequate. It doesn't explain what 'default context' entails, how it affects subsequent operations, or what the return value (if any) might be, leaving significant gaps for an agent to understand its full impact.

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 all four parameters. The description adds no additional meaning beyond stating they are optional, which is already implied by the schema (0 required parameters). This meets 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 verb ('Set') and resource ('default context for subsequent operations'), making the purpose understandable. However, it doesn't differentiate from its sibling tool 'gitea_context_get' (which presumably retrieves context), missing an opportunity for explicit distinction.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether authentication is needed), typical scenarios for setting context, or how it interacts with sibling tools like 'gitea_context_get' or workflow tools.

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/SupenBysz/gitea-mcp-tool'

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