Skip to content

fix(aws-documentation-mcp-server): search every section that search_table's title names - #5169

Open
burrows99 wants to merge 2 commits into
awslabs:mainfrom
burrows99:fix/search-table-repeated-section-titles
Open

burrows99 wants to merge 2 commits into
awslabs:mainfrom
burrows99:fix/search-table-repeated-section-titles

Conversation

@burrows99

Copy link
Copy Markdown

Fixes

Summary

Changes

search_table read only the last heading that matched section_title. On a page that repeats a title, it searched the wrong section and missed rows.

The Lambda quotas page (gettingstarted-limits.html) uses "Compute and storage" twice: once as an h2 for function quotas and once as an h3 under Lambda MicroVMs. With section_title="Compute and storage", the tool searched only the MicroVMs table. A query for "Concurrent executions", the most-asked Lambda quota, matched nothing.

  • parse_html_tables now collects the tables of every section whose heading matches, in page order. This matches how read_sections already returns every section with a given title.
  • A matching heading can sit inside another matching section (h2 Quotas > h3 Quotas). Its tables are counted once, and they keep their table_heading.
  • A title used only once still returns the same flat single-table result as before.
flowchart TD
    A[search_table with Compute and storage] --> B{Two headings match}
    B -->|Before| C[Only the last section is searched]
    B -->|After| D[Both sections are searched in page order]
Loading

User experience

Narrated recording, before then after (sound on):

search-table-evidence.mp4

The recording uses a saved copy of the Lambda quotas page and the same two calls search_table makes:

from awslabs.aws_documentation_mcp_server.table_utils import parse_html_tables, filter_table_rows
page = open('lambda-quotas.html').read()
found = parse_html_tables(page, 'Compute and storage')
[row['Resource'][:40] for t in found.get('tables', [found]) for row in t['rows']]
[row['Resource'] for t in found.get('tables', [found]) for row in filter_table_rows(t['rows'], 'concurrent executions')]

Before (main):

['Memory allocated across all MicroVMs (pe', 'Maximum execution duration per MicroVM']
[]

After:

['Concurrent executions', 'Storage for uploaded functions (.zip fil', 'Storage for functions defined as contain', '[Elastic network interfaces per virtual ', 'Memory allocated across all MicroVMs (pe', 'Maximum execution duration per MicroVM']
['Concurrent executions']

Edge cases and unchanged behaviour checked (in the recording, on the branch, against the saved page or inline HTML):

  • The title still matches in any case and spacing: 'compute AND storage' gives both tables.
  • A heading nested in another matching section is counted once: h2 Quotas (table a) > h3 Quotas (table b) gives [[{'Name': 'a'}], [{'Name': 'b'}]]. On main this returned only b.
  • Unchanged: a title used once ('Lambda API requests') still gives one flat table (['Resource', 'Quota'], 6 rows).
  • Unchanged: an unknown title still gives Section "Nonexistent" not found. With no title, all 13 tables on the page are still searched.

Tests (in src/aws-documentation-mcp-server):

  • Added test_repeated_section_title_searches_every_section and test_repeated_title_nested_in_matching_section_counts_tables_once to tests/test_table_utils.py. Both fail on main (KeyError: 'tables', because only one section's single table comes back) and pass with the fix.
  • pytest tests -m "not live" --ignore=tests/test_integ_basic.py: 512 passed, 30 deselected. test_integ_basic.py imports the repo-level testing package, which my sparse checkout did not include, so it was not run. Live tests were not run.
  • ruff format --check, ruff check and pyright on the changed module: clean.

AI assistance (Claude Code) was used to write this change and its description.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • I have reviewed the contributing guidelines
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Is this a breaking change? (Y/N) N

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

🤖 Generated with Claude Code

…able's title names

parse_html_tables kept only the last heading that matched section_title,
so on a page that repeats a title search_table read the wrong section.
On the Lambda quotas page, "Compute and storage" heads both the function
quotas (h2) and the Lambda MicroVMs quotas (h3); the tool searched only
the MicroVMs table and a query for "Concurrent executions" found nothing.

Collect the tables of every matching section, in page order, the same way
read_sections returns every section that carries a title. A table under a
matching heading nested inside another matching section is counted once.
Copilot AI balanced review requested due to automatic review settings November 22, 2026 18:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

…ated-section-titles

# Conflicts:
#	src/aws-documentation-mcp-server/CHANGELOG.md

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

2 participants