Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add server instructions based on toolsets#1091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
almaleksia merged 15 commits intogithub:mainfromolaservo:add-server-instructions
Sep 25, 2025

Conversation

olaservo
Copy link
Contributor

@olaservoolaservo commentedSep 15, 2025
edited
Loading

Hi, I am working on a post for the official MCP blog that focuses on server instructions (since clients have recently started to support this feature).

So far, I did some simple controlled evaluations using these changes locally, which you can find more details on here:https://github.com/olaservo/mcp-server-instructions-demo

Here is the PR for my blog post:modelcontextprotocol/modelcontextprotocol#1482

I haven't methodically tested all of these yet, but can do a similar evaluation and expand my tests to more models and clients, if we think this approach is promising.

Thanks!

@olaservoolaservo requested a review froma team as acode ownerSeptember 15, 2025 19:55
@CopilotCopilotAI review requested due to automatic review settingsSeptember 15, 2025 19:55
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR adds server instructions based on enabled toolsets to the GitHub MCP Server. The implementation generates context-aware instructions that help clients use the GitHub API tools more effectively based on which functionality is enabled.

  • Introduces aGenerateInstructions function that creates tailored instructions based on enabled toolsets
  • Adds comprehensive test coverage for instruction generation with different toolset combinations
  • Integrates the instruction system into the server initialization process

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

FileDescription
pkg/github/instructions.goImplements the core instruction generation logic with toolset-specific guidance
pkg/github/instructions_test.goProvides comprehensive test coverage for instruction generation scenarios
internal/ghmcp/server.goIntegrates instruction generation into the MCP server initialization

Tip: Customize your code reviews with copilot-instructions.md.Create the file orlearn how to get started.

}

// Base instruction with context management
baseInstruction := "The GitHub MCP Server provides GitHub API tools. Tool selection guidance: Use 'list_*' tools for broad, simple retrieval and pagination of all items of a type (e.g., all issues, all PRs, all branches) with basic filtering. Use 'search_*' tools for targeted queries with specific criteria, keywords, or complex filters (e.g., issues with certain text, PRs by author, code containing functions). Context management: 1) GitHub API responses can overflow context windows, 2) Process large datasets in batches of 5-10 items, 3) For summarization tasks, fetch minimal data first, then drill down into specifics."
Copy link
Preview

CopilotAISep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This long string literal is difficult to read and maintain. Consider breaking it into smaller constants or using a multi-line string with proper formatting to improve readability.

Copilot uses AI. Check for mistakes.

@olaservo
Copy link
ContributorAuthor

cc@tommaso-moro : here is another use case I have been experimenting with for using server instructions. Let me know what you think!

tommaso-moro reacted with eyes emoji

@tommaso-moro
Copy link
Contributor

tommaso-moro commentedSep 19, 2025
edited
Loading

@olaservo thank you for your work on this! This PR is in our radar and as you know we are discussing server instructions internally, so I will be in touch when we have updates:)

olaservo reacted with thumbs up emoji

Copy link
Contributor

@almaleksiaalmaleksia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you for adding this. I left some suggestions, mostly prompting related.

olaservo reacted with thumbs up emoji
Comment on lines 45 to 46
case "notifications":
return "Notifications: Filter by 'participating' for issues/PRs you're involved in. Use 'mark_all_notifications_read' with repository filters to avoid marking unrelated notifications."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm not sure that these instructions add value. If we wantedmark_all_notifications_read to be always called with repo argument we'd make this parameter required.

Regarding filtering - these instructions already included in the tool description.

olaservo reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Agree, I removed this one.


Context management:
1. Use pagination whenever possible with batches of 5-10 items.
2. Use minimal_output parameter set to true if the full information is not needed to accomplish a task.`
Copy link
Contributor

@tonytrgtonytrgSep 24, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Very good catch, thank you.

The llm cant be really confident in knowing what is contained in the minimal vs the verbose output. But since we have not established a standardized format for all offenders(big tool replies) I think this is good.

almaleksia reacted with thumbs up emoji
@SamMorrowDrums
Copy link
Collaborator

Thanks so much for this@olaservo you rock! 🪨

Copy link
Contributor

@tommaso-morotommaso-moro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good to me! Thank you@olaservo

@tonytrg
Copy link
Contributor

tonytrg commentedSep 24, 2025
edited
Loading

One thought I had - not blocking this review process though.

Should we add a cli flag/env var config optionCUSTOM_INSTRUCTIONS - to pass custom server instructions that get added optionally when passed.

I think that could be a nice feature for agents with specifc circumstances to customize their tool usage behaviour.

@almaleksiaalmaleksia merged commit0a1d6db intogithub:mainSep 25, 2025
10 checks passed
nickytonline pushed a commit to nickytonline/github-mcp-http that referenced this pull requestOct 4, 2025
* Add instruction generation for enabled toolsets and corresponding tests* Refactor instruction generation to always include base and context management instructions* Refactor base instruction for clarity and adjust context management instruction formatting* Simplify changes for now* Remove unused toolset instructions and simplify test cases for clarity* Add test cases for issues, notifications, and discussions toolsets in instruction generation* Update base instruction and test expectations for clarity on tool selection and context management* Add support for disabling instructions via environment variable* Clarify PR review workflow instruction for consistency* Apply suggestions from code reviewCo-authored-by: Ksenia Bobrova <almaleksia@github.com>* Refactor instruction generation and testing for clarity and consistency---------Co-authored-by: Ksenia Bobrova <almaleksia@github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tommaso-morotommaso-morotommaso-moro left review comments

@tonytrgtonytrgtonytrg left review comments

Copilot code reviewCopilotCopilot left review comments

@almaleksiaalmaleksiaalmaleksia approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@olaservo@tommaso-moro@SamMorrowDrums@tonytrg@almaleksia

[8]ページ先頭

©2009-2025 Movatter.jp